package com.blq.developtools.bean;

import android.graphics.Rect;

import androidx.lifecycle.ViewModel;

import com.blq.developtools.utils.DevelopUtils;

import java.util.ArrayList;
import java.util.List;

import blq.ssnb.snbutil.SnbDisplayUtil;

/**
 * <pre>
 * ****************************************************************
 * 文件名称:ViewTreeBean.java
 * 作 者:SSNB
 * 创建时间:2024/5/22
 * 文件描述:
 * 注意事项:
 * 版权声明:Copyright (C) 2015-2025 杭州中焯信息技术股份有限公司
 * 修改历史:2024/5/22 1.00 初始版本
 * ****************************************************************
 * </pre>
 */
public class ViewTreeBean {
    private String viewIDName;

    public String getViewIDName() {
        return viewIDName;
    }

    public void setViewIDName(String viewIDName) {
        if (viewIDName != null && !viewIDName.isEmpty()) {
            this.viewIDName = DevelopUtils.FormatResourceName(viewIDName);
        } else {
            this.viewIDName = "";
        }
    }

    private String classType;

    public String getClassType() {
        return classType;
    }

    public void setClassType(String classType) {
        this.classType = classType;
    }

    public String text;

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    private Rect inScreenLocation;

    public Rect getInScreenLocation() {
        if (inScreenLocation == null) {
            inScreenLocation = new Rect();
        }
        return inScreenLocation;
    }

    private Rect inParentLocation;

    public Rect getInParentLocation() {
        if (inParentLocation == null) {
            inParentLocation = new Rect();
        }
        return inParentLocation;
    }

    public int getWidth() {
        return getInScreenLocation().width();
    }

    public int getHeight() {
        return getInParentLocation().height();
    }

    private final List<ViewTreeBean> childView = new ArrayList<>();

    public List<ViewTreeBean> getChildView() {
        return childView;
    }

    public void setChildView(List<ViewTreeBean> childView) {
        if (childView == null) {
            childView = new ArrayList<>();
        }
        if (this.childView != childView) {
            this.childView.clear();
            this.childView.addAll(childView);
        }
    }

    private ViewTreeBean parentView;

    public ViewTreeBean getParentView() {
        return parentView;
    }

    public void setParentView(ViewTreeBean parentView) {
        this.parentView = parentView;
    }

    public int layerLevel;

    public int getLayerLevel() {
        return layerLevel;
    }

    public void setLayerLevel(int layerLevel) {
        this.layerLevel = layerLevel;
    }

    public int inParentLevel;

    public int getInParentLevel() {
        return inParentLevel;
    }

    public void setInParentLevel(int inParentLevel) {
        this.inParentLevel = inParentLevel;
    }


    private String packageName;

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    private String contentDescription;

    public String getContentDescription() {
        return contentDescription;
    }

    public void setContentDescription(String contentDescription) {
        this.contentDescription = contentDescription;
    }

    public boolean isVisibleToUser;
    public boolean isClickable;
    public boolean isLongClickable;
    public boolean isEnable;
    public boolean isFocusable;
    public boolean isFocused;
    public boolean isCheckable;
    public boolean isChecked;
    public boolean isScrollable;
    public boolean isEditable;
    public boolean isSelected;
    public boolean isPassword;

}
